1. Field of the Invention
The present invention relates to a technique of detecting a specific object region contained in an image by an image processing.
2. Description of the Background Art
In the manufacturing steps of a substrate such as a printed board, a variety of defects occur on a pad pattern (e.g., a circuit and wiring pattern) formed on a substrate. FIG. 21 shows an example of such defects. There has conventionally been known a technique related to an inspection apparatus for detecting such a pad pattern defect as shown in FIG. 21.
In the inspection apparatus with the above technique, a substrate image is captured, and the captured image is subjected to a predetermined image processing for detecting a defect. The operation of the conventional inspection apparatus and image processing will briefly be described as follows.
Firstly, the pixel value of each pixel in the image of a non-defective substrate selected by an operator's visual check or continuity test is subjected to binarization by a predetermined threshold value, and a reference mask image is then generated.
Subsequently, an inspecting mask image for setting an inspection region on the substrate is generated based on the generated reference mask image and the image of a substrate to be inspected (inspecting image).
Then, while selecting a pixel forming a pad in the inspection region based on the inspecting mask image, it is checked whether the chromatic density of the selected pixel in the inspecting image is in the range of a threshold value. Based on the result, it is judged whether each pixel is a pixel constituting a defect (i.e., a defect pixel), thereby generating a defect image, each pixel of which is represented by a pixel value indicating a defect pixel or not.
Further, based on the defect image, a defect region is sampled which is a region where defect pixels are adjacent to each other and can be regarded as a region forming a single defect. Defect detection is performed by judging whether the defect region is a defect or not based on characteristic features such as the location and size of the defect region.
Thereafter, the operator checks and judges whether the individual defect detected by the inspection apparatus is actually a defect or not.
It should be noted that it is impossible to completely eliminate positioning error etc. in the manufacturing steps of a substrate and even a non-defective substrate can cause any error in the position and size of a pad. When a reference mask image generated from the image of this non-defective substrate having such error is used for defect inspection, a misregistration error (e.g., a portion that is not an actual defect as shown in FIG. 21) is recognized as a defect, causing an erroneous detection of defect in the contour part of the pad.
Therefore, in the inspection apparatus with the above-mentioned technique, it is necessary to narrow (reduce) the area of a mask, and a reference mask is generated by further performing reduction processing of the image obtained by binarization. However, this inspection apparatus suffers from the problem that the reduction processing in generating a reference mask causes a dead zone (a region not subjected to any defect detection), and the sensing rate of defect lowers, resulting in the increased miss of defect.
When the size of a region previously detected as a defect is smaller than a predetermined area (the number of pixels), this region is not regarded as a defect, in order to prevent over detection of the defect due to image non-uniformity etc. Therefore, when defects having an area less than the predetermined area are gathered, these defects may be overlooked, although they should be detected as a single defect, in consideration of the adverse effect upon the product.
Furthermore, in the image processing with the above-mentioned technique, a processing for sampling pixels forming the contour of a specific region (i.e., contour pixels) is performed, for example, to judge in which pad a detected defect region is contained, or find the location of a defect (the centroidal location). In this processing, the contour pixels are sampled by comparisons of the pixel values of all the pixels contained in an image and their respective adjacent pixels. Therefore, this processing requires a large amount of arithmetic operation, thus failing to execute the image processing at high speed.